package com.retailshop.shopuser.WapUserController;

import com.retailshop.shopuser.common.MessageConstants;
import com.retailshop.shopuser.common.Response;
import com.retailshop.shopuser.entity.UserNo;
import com.retailshop.shopuser.service.UserNoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
@CrossOrigin
@Controller
@RequestMapping("/wap")
public class WapUserInfoController {


    @Autowired
    UserNoService userNoService;

    /**
     * 根据用户编号ID查询用户信息
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getNoInfo",method = RequestMethod.POST)
    public Response getUserNoInfo(HttpServletRequest request){
        String userNoIds=request.getParameter("userNoId");
        int userNoId=0;
        UserNo userNo=null;
        if(userNoIds!=null&&userNoIds!=""){
            userNoId=Integer.parseInt(userNoIds);
            userNo = userNoService.selectByPrimaryKey(userNoId);
            System.out.println(userNo.getId());
        }

        return new Response(MessageConstants.MSG_SUCCESS,userNo,0,"",request);
    }
}
